package com.example.cd5160866.activityanimotion;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

/**
 * Created by cd5160866 on 16/9/7.
 */
public class TestActivity extends AnimationBaseActivity {
    private static String TEST_KEY = "test_key";

    /**
     * 随便写的方法用于测试参数传递这里以String类型为例，如果有别的需求直接咨询随意加即可
     *
     * @param context
     * @param testValue
     */
    public static void startWithNew(Context context, String testValue) {
        Intent intent = getLaunchIntent(context, TestActivity.class).putExtra(TEST_KEY, testValue);
        startWithNewAnimation(context, intent);
    }

    public static void startWithOld(Context context, String testValue) {
        Intent intent = getLaunchIntent(context, TestActivity.class).putExtra(TEST_KEY, testValue);
        startWithOldAnimation(context, intent);
    }

    public static void startWithOld(Context context, int enterAnimation, int exiteAnimation, String testValue) {
        Intent intent = getLaunchIntent(context, TestActivity.class).putExtra(TEST_KEY, testValue);
        startWithOldAnimation(context, intent, enterAnimation, exiteAnimation);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test_activity);
        findViewById(R.id.finish).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        initData();
    }

    /**
     * 处理数据传递
     */
    private void initData() {
        Toast.makeText(this, getIntent().getExtras().getString(TEST_KEY, ""), Toast.LENGTH_SHORT).show();
    }
}
